package lsf.itcast.service.imp;

import com.github.pagehelper.PageHelper;
import lsf.itcast.dao.OrdersDao;
import lsf.itcast.domain.Orders;
import lsf.itcast.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class OrdersServiceImp implements OrdersService {
    @Autowired
    private OrdersDao ordersDao;
    @Override
    public List<Orders> findAllOrder(int page,int pageSize) {
        //注意，此方法，是专门设置分页参数的方法
        // 实在查询语句执行之前执行的，在得到查询结果之前，不能插入查询语句
        PageHelper.startPage(page,pageSize);
        return ordersDao.findAllOrder();
    }

    @Override
    public Orders findById(String id) {
       return ordersDao.findById(id);
    }
}
